home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / quake_ad.zip / WAIT4P99.ZIP / CLIENT.QC next >
Text File  |  1997-03-12  |  34KB  |  1,443 lines

  1. //Search for Wait4Player
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. /*
  13. =============================================================================
  14.  
  15.                 LEVEL CHANGING / INTERMISSION
  16.  
  17. =============================================================================
  18. */
  19.  
  20. float    intermission_running;
  21. float    intermission_exittime;
  22.  
  23. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  24. This is the camera point for the intermission.
  25. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  26. */
  27. void() info_intermission =
  28. {
  29. };
  30.  
  31.  
  32.  
  33. void() SetChangeParms =
  34. {
  35.     if (self.health <= 0)
  36.     {
  37.         SetNewParms ();
  38.         return;
  39.     }
  40.  
  41. // remove items
  42.     self.items = self.items - (self.items & 
  43.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  44.     
  45. // cap super health
  46.     if (self.health > 100)
  47.         self.health = 100;
  48.     if (self.health < 50)
  49.         self.health = 50;
  50.     parm1 = self.items;
  51.     parm2 = self.health;
  52.     parm3 = self.armorvalue;
  53.     if (self.ammo_shells < 25)
  54.         parm4 = 25;
  55.     else
  56.         parm4 = self.ammo_shells;
  57.     parm5 = self.ammo_nails;
  58.     parm6 = self.ammo_rockets;
  59.     parm7 = self.ammo_cells;
  60.     parm8 = self.weapon;
  61.     parm9 = self.armortype * 100;
  62. };
  63.  
  64. void() SetNewParms =
  65. {
  66.     parm1 = IT_SHOTGUN | IT_AXE;
  67.     parm2 = 100;
  68.     parm3 = 0;
  69.     parm4 = 25;
  70.     parm5 = 0;
  71.     parm6 = 0;
  72.     parm7 = 0;
  73.     parm8 = 1;
  74.     parm9 = 0;
  75. };
  76.  
  77. void() DecodeLevelParms =
  78. {
  79.     if (serverflags)
  80.     {
  81.         if (world.model == "maps/start.bsp")
  82.             SetNewParms ();        // take away all stuff on starting new episode
  83.     }
  84.     
  85.     self.items = parm1;
  86.     self.health = parm2;
  87.     self.armorvalue = parm3;
  88.     self.ammo_shells = parm4;
  89.     self.ammo_nails = parm5;
  90.     self.ammo_rockets = parm6;
  91.     self.ammo_cells = parm7;
  92.     self.weapon = parm8;
  93.     self.armortype = parm9 * 0.01;
  94. };
  95.  
  96. /*
  97. ============
  98. FindIntermission
  99.  
  100. Returns the entity to view from
  101. ============
  102. */
  103. entity() FindIntermission =
  104. {
  105.     local    entity spot;
  106.     local    float cyc;
  107.  
  108. // look for info_intermission first
  109.     spot = find (world, classname, "info_intermission");
  110.     if (spot)
  111.     {    // pick a random one
  112.         cyc = random() * 4;
  113.         while (cyc > 1)
  114.         {
  115.             spot = find (spot, classname, "info_intermission");
  116.             if (!spot)
  117.                 spot = find (spot, classname, "info_intermission");
  118.             cyc = cyc - 1;
  119.         }
  120.         return spot;
  121.     }
  122.  
  123. // then look for the start position
  124.     spot = find (world, classname, "info_player_start");
  125.     if (spot)
  126.         return spot;
  127.     
  128. // testinfo_player_start is only found in regioned levels
  129.     spot = find (world, classname, "testplayerstart");
  130.     if (spot)
  131.         return spot;
  132.     
  133.     objerror ("FindIntermission: no spot");
  134. };
  135.  
  136.  
  137. string nextmap;
  138. void() GotoNextMap =
  139. {
  140.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  141.         changelevel (mapname);
  142.     else
  143.         changelevel (nextmap);
  144. };
  145.  
  146.  
  147. void() ExitIntermission =
  148. {
  149. // skip any text in deathmatch
  150.     if (deathmatch)
  151.     {
  152.         GotoNextMap ();
  153.         return;
  154.     }
  155.     
  156.     intermission_exittime = time + 1;
  157.     intermission_running = intermission_running + 1;
  158.  
  159. //
  160. // run some text if at the end of an episode
  161. //
  162.     if (intermission_running == 2)
  163.     {
  164.         if (world.model == "maps/e1m7.bsp")
  165.         {
  166.             WriteByte (MSG_ALL, SVC_CDTRACK);
  167.             WriteByte (MSG_ALL, 2);
  168.             WriteByte (MSG_ALL, 3);
  169.             if (!cvar("registered"))
  170.             {
  171.                 WriteByte (MSG_ALL, SVC_FINALE);
  172.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  173.             }
  174.             else
  175.             {
  176.                 WriteByte (MSG_ALL, SVC_FINALE);
  177.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  178.             }
  179.             return;
  180.         }
  181.         else if (world.model == "maps/e2m6.bsp")
  182.         {
  183.             WriteByte (MSG_ALL, SVC_CDTRACK);
  184.             WriteByte (MSG_ALL, 2);
  185.             WriteByte (MSG_ALL, 3);
  186.  
  187.             WriteByte (MSG_ALL, SVC_FINALE);
  188.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  189.             return;
  190.         }
  191.         else if (world.model == "maps/e3m6.bsp")
  192.         {
  193.             WriteByte (MSG_ALL, SVC_CDTRACK);
  194.             WriteByte (MSG_ALL, 2);
  195.             WriteByte (MSG_ALL, 3);
  196.  
  197.             WriteByte (MSG_ALL, SVC_FINALE);
  198.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  199.             return;
  200.         }
  201.         else if (world.model == "maps/e4m7.bsp")
  202.         {
  203.             WriteByte (MSG_ALL, SVC_CDTRACK);
  204.             WriteByte (MSG_ALL, 2);
  205.             WriteByte (MSG_ALL, 3);
  206.  
  207.             WriteByte (MSG_ALL, SVC_FINALE);
  208.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  209.             return;
  210.         }
  211.  
  212.         GotoNextMap();
  213.     }
  214.     
  215.     if (intermission_running == 3)
  216.     {
  217.         if (!cvar("registered"))
  218.         {    // shareware episode has been completed, go to sell screen
  219.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  220.             return;
  221.         }
  222.         
  223.         if ( (serverflags&15) == 15)
  224.         {
  225.             WriteByte (MSG_ALL, SVC_FINALE);
  226.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  227.             return;
  228.         }
  229.         
  230.     }
  231.  
  232.     GotoNextMap();
  233. };
  234.  
  235. /*
  236. ============
  237. IntermissionThink
  238.  
  239. When the player presses attack or jump, change to the next level
  240. ============
  241. */
  242. void() IntermissionThink =
  243. {
  244.     if (time < intermission_exittime)
  245.         return;
  246.  
  247.     if (!self.button0 && !self.button1 && !self.button2)
  248.         return;
  249.     
  250.     ExitIntermission ();
  251. };
  252.  
  253. void() execute_changelevel =
  254. {
  255.     local entity    pos;
  256.  
  257.     intermission_running = 1;
  258.     
  259. // enforce a wait time before allowing changelevel
  260.     if (deathmatch)
  261.         intermission_exittime = time + 5;
  262.     else
  263.         intermission_exittime = time + 2;
  264.  
  265.     WriteByte (MSG_ALL, SVC_CDTRACK);
  266.     WriteByte (MSG_ALL, 3);
  267.     WriteByte (MSG_ALL, 3);
  268.     
  269.     pos = FindIntermission ();
  270.  
  271.     other = find (world, classname, "player");
  272.     while (other != world)
  273.     {
  274.         other.view_ofs = '0 0 0';
  275.         other.angles = other.v_angle = pos.mangle;
  276.         other.fixangle = TRUE;        // turn this way immediately
  277.         other.nextthink = time + 0.5;
  278.         other.takedamage = DAMAGE_NO;
  279.         other.solid = SOLID_NOT;
  280.         other.movetype = MOVETYPE_NONE;
  281.         other.modelindex = 0;
  282.         setorigin (other, pos.origin);
  283.         other = find (other, classname, "player");
  284.     }    
  285.  
  286.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  287. };
  288.  
  289.  
  290. void() changelevel_touch =
  291. {
  292.     local entity    pos;
  293.  
  294.     if (other.classname != "player")
  295.         return;
  296.  
  297.     if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start")))
  298.     {
  299.         T_Damage (other, self, self, 50000);
  300.         return;
  301.     }
  302.  
  303.     if (coop || deathmatch)
  304.     {
  305.         bprint (other.netname);
  306.         bprint (" exited the level\n");
  307.     }
  308.     
  309.     nextmap = self.map;
  310.  
  311.     SUB_UseTargets ();
  312.  
  313.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  314.     {    // NO_INTERMISSION
  315.         GotoNextMap();
  316.         return;
  317.     }
  318.     
  319.     self.touch = SUB_Null;
  320.  
  321. // we can't move people right now, because touch functions are called
  322. // in the middle of C movement code, so set a think time to do it
  323.     self.think = execute_changelevel;
  324.     self.nextthink = time + 0.1;
  325. };
  326.  
  327. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  328. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  329. */
  330. void() trigger_changelevel =
  331. {
  332.     if (!self.map)
  333.         objerror ("chagnelevel trigger doesn't have map");
  334.     
  335.     InitTrigger ();
  336.     self.touch = changelevel_touch;
  337. };
  338.  
  339.  
  340. /*
  341. =============================================================================
  342.  
  343.                 PLAYER GAME EDGE FUNCTIONS
  344.  
  345. =============================================================================
  346. */
  347.  
  348. void() set_suicide_frame;
  349.  
  350. // called by ClientKill and DeadThink
  351. void() respawn =
  352. {
  353.     if (coop)
  354.     {
  355.         // make a copy of the dead body for appearances sake
  356.         CopyToBodyQue (self);
  357.         // get the spawn parms as they were at level start
  358.         setspawnparms (self);
  359.         // respawn        
  360.         PutClientInServer ();
  361.     }
  362.     else if (deathmatch)
  363.     {
  364.         // make a copy of the dead body for appearances sake
  365.         CopyToBodyQue (self);
  366.         // set default spawn parms
  367.         SetNewParms ();
  368.         // respawn        
  369.         PutClientInServer ();
  370.     }
  371.     else
  372.     {    // restart the entire server
  373.         localcmd ("restart\n");
  374.     }
  375. };
  376.  
  377.  
  378. /*
  379. ============
  380. ClientKill
  381.  
  382. Player entered the suicide command
  383. ============
  384. */
  385. void() ClientKill =
  386. {
  387.     bprint (self.netname);
  388.     bprint (" suicides\n");
  389.     set_suicide_frame ();
  390.     self.modelindex = modelindex_player;
  391.     self.frags = self.frags - 2;    // extra penalty
  392.     respawn ();
  393. };
  394.  
  395. float(vector v) CheckSpawnPoint =
  396. {
  397.     return FALSE;
  398. };
  399.  
  400. /*
  401. ============
  402. SelectSpawnPoint
  403.  
  404. Returns the entity to spawn at
  405. ============
  406. */
  407. entity() SelectSpawnPoint =
  408. {
  409.     local    entity spot;
  410.     local    entity thing;
  411.     local    float  pcount;
  412.     
  413. // testinfo_player_start is only found in regioned levels
  414.     spot = find (world, classname, "testplayerstart");
  415.     if (spot)
  416.         return spot;
  417.         
  418. // choose a info_player_deathmatch point
  419.     if (coop)
  420.     {
  421.         lastspawn = find(lastspawn, classname, "info_player_coop");
  422.         if (lastspawn == world)
  423.             lastspawn = find (lastspawn, classname, "info_player_start");
  424.         if (lastspawn != world)
  425.             return lastspawn;
  426.     }
  427.     else if (deathmatch)
  428.     {
  429.         spot = lastspawn;
  430.         while (1)
  431.         {
  432.             spot = find(spot, classname, "info_player_deathmatch");
  433.             if (spot != world)
  434.             {
  435.                 if (spot == lastspawn)
  436.                     return lastspawn;
  437.                 pcount = 0;
  438.                 thing = findradius(spot.origin, 32);
  439.                 while(thing)
  440.                 {
  441.                     if (thing.classname == "player")
  442.                         pcount = pcount + 1;
  443.                     thing = thing.chain;
  444.                 }
  445.                 if (pcount == 0)
  446.                 {
  447.                     lastspawn = spot;
  448.                     return spot;
  449.                 }
  450.             }
  451.         }
  452.     }
  453.  
  454.     if (serverflags)
  455.     {    // return with a rune to start
  456.         spot = find (world, classname, "info_player_start2");
  457.         if (spot)
  458.             return spot;
  459.     }
  460.     
  461.     spot = find (world, classname, "info_player_start");
  462.     if (!spot)
  463.         error ("PutClientInServer: no info_player_start on level");
  464.     
  465.     return spot;
  466. };
  467.  
  468. /*
  469. ===========
  470. PutClientInServer
  471.  
  472. called each time a player is spawned
  473. ============
  474. */
  475. void() DecodeLevelParms;
  476. void() PlayerDie;
  477.  
  478.  
  479. void() PutClientInServer =
  480. {
  481.     local    entity spot;
  482.  
  483.     spot = SelectSpawnPoint ();
  484.  
  485.     self.classname = "player";
  486.     self.health = 100;
  487.     self.takedamage = DAMAGE_AIM;
  488.     self.solid = SOLID_SLIDEBOX;
  489.     self.movetype = MOVETYPE_WALK;
  490.     self.show_hostile = 0;
  491.     self.max_health = 100;
  492.     self.flags = FL_CLIENT;
  493.     self.air_finished = time + 12;
  494.     self.dmg = 2;           // initial water damage
  495.     self.super_damage_finished = 0;
  496.     self.radsuit_finished = 0;
  497.     self.invisible_finished = 0;
  498.     self.invincible_finished = 0;
  499.     self.effects = 0;
  500.     self.invincible_time = 0;
  501.  
  502.     DecodeLevelParms ();
  503.     
  504.     W_SetCurrentAmmo ();
  505.  
  506.     self.attack_finished = time;
  507.     self.th_pain = player_pain;
  508.     self.th_die = PlayerDie;
  509.     
  510.     self.deadflag = DEAD_NO;
  511. // paustime is set by teleporters to keep the player from moving a while
  512.     self.pausetime = 0;
  513.     
  514. //    spot = SelectSpawnPoint ();
  515.  
  516.     self.origin = spot.origin + '0 0 1';
  517.     self.angles = spot.angles;
  518.     self.fixangle = TRUE;        // turn this way immediately
  519.  
  520. // oh, this is a hack!
  521.     setmodel (self, "progs/eyes.mdl");
  522.     modelindex_eyes = self.modelindex;
  523.  
  524.     setmodel (self, "progs/player.mdl");
  525.     modelindex_player = self.modelindex;
  526.  
  527.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  528.     
  529.     self.view_ofs = '0 0 22';
  530.  
  531.     player_stand1 ();
  532.     
  533.     if (deathmatch || coop)
  534.     {
  535.         makevectors(self.angles);
  536.         spawn_tfog (self.origin + v_forward*20);
  537.     }
  538.  
  539.     spawn_tdeath (self.origin, self);
  540. };
  541.  
  542.  
  543. /*
  544. =============================================================================
  545.  
  546.                 QUAKED FUNCTIONS
  547.  
  548. =============================================================================
  549. */
  550.  
  551.  
  552. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  553. The normal starting point for a level.
  554. */
  555. void() info_player_start =
  556. {
  557. };
  558.  
  559.  
  560. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  561. Only used on start map for the return point from an episode.
  562. */
  563. void() info_player_start2 =
  564. {
  565. };
  566.  
  567.  
  568. /*
  569. saved out by quaked in region mode
  570. */
  571. void() testplayerstart =
  572. {
  573. };
  574.  
  575. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  576. potential spawning position for deathmatch games
  577. */
  578. void() info_player_deathmatch =
  579. {
  580. };
  581.  
  582. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  583. potential spawning position for coop games
  584. */
  585. void() info_player_coop =
  586. {
  587. };
  588.  
  589. /*
  590. ===============================================================================
  591.  
  592. RULES
  593.  
  594. ===============================================================================
  595. */
  596.  
  597. /*
  598. go to the next level for deathmatch
  599. only called if a time or frag limit has expired
  600. */
  601. void() NextLevel =
  602. {
  603.     local entity o;
  604.  
  605.     if (mapname == "start")
  606.     {
  607.         if (!cvar("registered"))
  608.         {
  609.             mapname = "e1m1";
  610.         }
  611.         else if (!(serverflags & 1))
  612.         {
  613.             mapname = "e1m1";
  614.             serverflags = serverflags | 1;
  615.         }
  616.         else if (!(serverflags & 2))
  617.         {
  618.             mapname = "e2m1";
  619.             serverflags = serverflags | 2;
  620.         }
  621.         else if (!(serverflags & 4))
  622.         {
  623.             mapname = "e3m1";
  624.             serverflags = serverflags | 4;
  625.         }
  626.         else if (!(serverflags & 8))
  627.         {
  628.             mapname = "e4m1";
  629.             serverflags = serverflags - 7;
  630.         }
  631.  
  632.         o = spawn();
  633.         o.map = mapname;
  634.     }
  635.     else
  636.     {
  637.         // find a trigger changelevel
  638.         o = find(world, classname, "trigger_changelevel");
  639.  
  640.         // go back to start if no trigger_changelevel
  641.         if (!o)
  642.         {
  643.             mapname = "start";
  644.             o = spawn();
  645.             o.map = mapname;
  646.         }
  647.     }
  648.  
  649.     nextmap = o.map;
  650.     gameover = TRUE;
  651.     
  652.     if (o.nextthink < time)
  653.     {
  654.         o.think = execute_changelevel;
  655.         o.nextthink = time + 0.1;
  656.     }
  657. };
  658.  
  659. /*
  660. ============
  661. CheckRules
  662.  
  663. Exit deathmatch games upon conditions
  664. ============
  665. */
  666. void() CheckRules =
  667. {
  668.     local    float        timelimit;
  669.     local    float        fraglimit;
  670.     
  671.     if (gameover)    // someone else quit the game already
  672.         return;
  673.         
  674.     timelimit = cvar("timelimit") * 60;
  675.     fraglimit = cvar("fraglimit");
  676. //Wait4Player start: 
  677.         if (UseWait4Player==0) WaitforPlayer();
  678. //Wait4Player end!
  679.     if (timelimit && time >= timelimit)
  680.     {
  681.         NextLevel ();
  682.         return;
  683.     }
  684.     
  685.     if (fraglimit && self.frags >= fraglimit)
  686.     {
  687.         NextLevel ();
  688.         return;
  689.     }    
  690. };
  691.  
  692. //============================================================================
  693.  
  694. void() PlayerDeathThink =
  695. {
  696.     local entity    old_self;
  697.     local float        forward;
  698.  
  699.     if ((self.flags & FL_ONGROUND))
  700.     {
  701.         forward = vlen (self.velocity);
  702.         forward = forward - 20;
  703.         if (forward <= 0)
  704.             self.velocity = '0 0 0';
  705.         else    
  706.             self.velocity = forward * normalize(self.velocity);
  707.     }
  708.  
  709. // wait for all buttons released
  710.     if (self.deadflag == DEAD_DEAD)
  711.     {
  712.         if (self.button2 || self.button1 || self.button0)
  713.             return;
  714.         self.deadflag = DEAD_RESPAWNABLE;
  715.         return;
  716.     }
  717.  
  718. // wait for any button down
  719.     if (!self.button2 && !self.button1 && !self.button0)
  720.         return;
  721.  
  722.     self.button0 = 0;
  723.     self.button1 = 0;
  724.     self.button2 = 0;
  725.     respawn();
  726. };
  727.  
  728.  
  729. void() PlayerJump =
  730. {
  731.     local vector start, end;
  732.     
  733.     if (self.flags & FL_WATERJUMP)
  734.         return;
  735.     
  736.     if (self.waterlevel >= 2)
  737.     {
  738.         if (self.watertype == CONTENT_WATER)
  739.             self.velocity_z = 100;
  740.         else if (self.watertype == CONTENT_SLIME)
  741.             self.velocity_z = 80;
  742.         else
  743.             self.velocity_z = 50;
  744.  
  745. // play swiming sound
  746.         if (self.swim_flag < time)
  747.         {
  748.             self.swim_flag = time + 1;
  749.             if (random() < 0.5)
  750.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  751.             else
  752.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  753.         }
  754.  
  755.         return;
  756.     }
  757.  
  758.     if (!(self.flags & FL_ONGROUND))
  759.         return;
  760.  
  761.     if ( !(self.flags & FL_JUMPRELEASED) )
  762.         return;        // don't pogo stick
  763.  
  764.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  765.  
  766.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  767.     
  768.     self.button2 = 0;
  769. // player jumping sound
  770.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  771.     self.velocity_z = self.velocity_z + 270;
  772. };
  773.  
  774.  
  775. /*
  776. ===========
  777. WaterMove
  778.  
  779. ============
  780. */
  781. .float    dmgtime;
  782.  
  783. void() WaterMove =
  784. {
  785. //dprint (ftos(self.waterlevel));
  786.     if (self.movetype == MOVETYPE_NOCLIP)
  787.         return;
  788.     if (self.health < 0)
  789.         return;
  790.  
  791.     if (self.waterlevel != 3)
  792.     {
  793.         if (self.air_finished < time)
  794.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  795.         else if (self.air_finished < time + 9)
  796.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  797.         self.air_finished = time + 12;
  798.         self.dmg = 2;
  799.     }
  800.     else if (self.air_finished < time)
  801.     {    // drown!
  802.         if (self.pain_finished < time)
  803.         {
  804.             self.dmg = self.dmg + 2;
  805.             if (self.dmg > 15)
  806.                 self.dmg = 10;
  807.             T_Damage (self, world, world, self.dmg);
  808.             self.pain_finished = time + 1;
  809.         }
  810.     }
  811.     
  812.     if (!self.waterlevel)
  813.     {
  814.         if (self.flags & FL_INWATER)
  815.         {    
  816.             // play leave water sound
  817.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  818.             self.flags = self.flags - FL_INWATER;
  819.         }
  820.         return;
  821.     }
  822.  
  823.     if (self.watertype == CONTENT_LAVA)
  824.     {    // do damage
  825.         if (self.dmgtime < time)
  826.         {
  827.             if (self.radsuit_finished > time)
  828.                 self.dmgtime = time + 1;
  829.             else
  830.                 self.dmgtime = time + 0.2;
  831.  
  832.             T_Damage (self, world, world, 10*self.waterlevel);
  833.         }
  834.     }
  835.     else if (self.watertype == CONTENT_SLIME)
  836.     {    // do damage
  837.         if (self.dmgtime < time && self.radsuit_finished < time)
  838.         {
  839.             self.dmgtime = time + 1;
  840.             T_Damage (self, world, world, 4*self.waterlevel);
  841.         }
  842.     }
  843.     
  844.     if ( !(self.flags & FL_INWATER) )
  845.     {    
  846.  
  847. // player enter water sound
  848.  
  849.         if (self.watertype == CONTENT_LAVA)
  850.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  851.         if (self.watertype == CONTENT_WATER)
  852.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  853.         if (self.watertype == CONTENT_SLIME)
  854.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  855.  
  856.         self.flags = self.flags + FL_INWATER;
  857.         self.dmgtime = 0;
  858.     }
  859.     
  860.     if (! (self.flags & FL_WATERJUMP) )
  861.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  862. };
  863.  
  864. void() CheckWaterJump =
  865. {
  866.     local vector start, end;
  867.  
  868. // check for a jump-out-of-water
  869.     makevectors (self.angles);
  870.     start = self.origin;
  871.     start_z = start_z + 8; 
  872.     v_forward_z = 0;
  873.     normalize(v_forward);
  874.     end = start + v_forward*24;
  875.     traceline (start, end, TRUE, self);
  876.     if (trace_fraction < 1)
  877.     {    // solid at waist
  878.         start_z = start_z + self.maxs_z - 8;
  879.         end = start + v_forward*24;
  880.         self.movedir = trace_plane_normal * -50;
  881.         traceline (start, end, TRUE, self);
  882.         if (trace_fraction == 1)
  883.         {    // open at eye level
  884.             self.flags = self.flags | FL_WATERJUMP;
  885.             self.velocity_z = 225;
  886.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  887.             self.teleport_time = time + 2;    // safety net
  888.             return;
  889.         }
  890.     }
  891. };
  892.  
  893.  
  894. /*
  895. ================
  896. PlayerPreThink
  897.  
  898. Called every frame before physics are run
  899. ================
  900. */
  901. void() PlayerPreThink =
  902. {
  903.     local    float    mspeed, aspeed;
  904.     local    float    r;
  905.  
  906.     if (intermission_running)
  907.     {
  908.         IntermissionThink ();    // otherwise a button could be missed between
  909.         return;                    // the think tics
  910.     }
  911.  
  912.     if (self.view_ofs == '0 0 0')
  913.         return;        // intermission or finale
  914.  
  915.     makevectors (self.v_angle);        // is this still used
  916.  
  917.     CheckRules ();
  918.     WaterMove ();
  919.  
  920.     if (self.waterlevel == 2)
  921.         CheckWaterJump ();
  922.  
  923.     if (self.deadflag >= DEAD_DEAD)
  924.     {
  925.         PlayerDeathThink ();
  926.         return;
  927.     }
  928.     
  929.     if (self.deadflag == DEAD_DYING)
  930.         return;    // dying, so do nothing
  931.  
  932.     if (self.button2)
  933.     {
  934.         PlayerJump ();
  935.     }
  936.     else
  937.         self.flags = self.flags | FL_JUMPRELEASED;
  938.  
  939. // teleporters can force a non-moving pause time    
  940.     if (time < self.pausetime)
  941.         self.velocity = '0 0 0';
  942.  
  943.     if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE)
  944.     {
  945.         self.weapon = W_BestWeapon ();
  946.         W_SetCurrentAmmo ();
  947.     }
  948. };
  949.     
  950. /*
  951. ================
  952. CheckPowerups
  953.  
  954. Check for turning off powerups
  955. ================
  956. */
  957. void() CheckPowerups =
  958. {
  959.     if (self.health <= 0)
  960.         return;
  961.  
  962. // invisibility
  963.     if (self.invisible_finished)
  964.     {
  965. // sound and screen flash when items starts to run out
  966.         if (self.invisible_sound < time)
  967.         {
  968.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  969.             self.invisible_sound = time + ((random() * 3) + 1);
  970.         }
  971.  
  972.  
  973.         if (self.invisible_finished < time + 3)
  974.         {
  975.             if (self.invisible_time == 1)
  976.             {
  977.                 sprint (self, "Ring of Shadows magic is fading\n");
  978.                 stuffcmd (self, "bf\n");
  979.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  980.                 self.invisible_time = time + 1;
  981.             }
  982.             
  983.             if (self.invisible_time < time)
  984.             {
  985.                 self.invisible_time = time + 1;
  986.                 stuffcmd (self, "bf\n");
  987.             }
  988.         }
  989.  
  990.         if (self.invisible_finished < time)
  991.         {    // just stopped
  992.             self.items = self.items - IT_INVISIBILITY;
  993.             self.invisible_finished = 0;
  994.             self.invisible_time = 0;
  995.         }
  996.         
  997.     // use the eyes
  998.         self.frame = 0;
  999.         self.modelindex = modelindex_eyes;
  1000.     }
  1001.     else
  1002.         self.modelindex = modelindex_player;    // don't use eyes
  1003.  
  1004. // invincibility
  1005.     if (self.invincible_finished)
  1006.     {
  1007. // sound and screen flash when items starts to run out
  1008.         if (self.invincible_finished < time + 3)
  1009.         {
  1010.             if (self.invincible_time == 1)
  1011.             {
  1012.                 sprint (self, "Protection is almost burned out\n");
  1013.                 stuffcmd (self, "bf\n");
  1014.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1015.                 self.invincible_time = time + 1;
  1016.             }
  1017.             
  1018.             if (self.invincible_time < time)
  1019.             {
  1020.                 self.invincible_time = time + 1;
  1021.                 stuffcmd (self, "bf\n");
  1022.             }
  1023.         }
  1024.         
  1025.         if (self.invincible_finished < time)
  1026.         {    // just stopped
  1027.             self.items = self.items - IT_INVULNERABILITY;
  1028.             self.invincible_time = 0;
  1029.             self.invincible_finished = 0;
  1030.         }
  1031.         if (self.invincible_finished > time)
  1032.             self.effects = self.effects | EF_DIMLIGHT;
  1033.         else
  1034.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1035.     }
  1036.  
  1037. // super damage
  1038.     if (self.super_damage_finished)
  1039.     {
  1040.  
  1041. // sound and screen flash when items starts to run out
  1042.  
  1043.         if (self.super_damage_finished < time + 3)
  1044.         {
  1045.             if (self.super_time == 1)
  1046.             {
  1047.                 sprint (self, "Quad Damage is wearing off\n");
  1048.                 stuffcmd (self, "bf\n");
  1049.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1050.                 self.super_time = time + 1;
  1051.             }      
  1052.             
  1053.             if (self.super_time < time)
  1054.             {
  1055.                 self.super_time = time + 1;
  1056.                 stuffcmd (self, "bf\n");
  1057.             }
  1058.         }
  1059.  
  1060.         if (self.super_damage_finished < time)
  1061.         {    // just stopped
  1062.             self.items = self.items - IT_QUAD;
  1063.             self.super_damage_finished = 0;
  1064.             self.super_time = 0;
  1065.         }
  1066.         if (self.super_damage_finished > time)
  1067.             self.effects = self.effects | EF_DIMLIGHT;
  1068.         else
  1069.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1070.     }    
  1071.  
  1072. // suit    
  1073.     if (self.radsuit_finished)
  1074.     {
  1075.         self.air_finished = time + 12;        // don't drown
  1076.  
  1077. // sound and screen flash when items starts to run out
  1078.         if (self.radsuit_finished < time + 3)
  1079.         {
  1080.             if (self.rad_time == 1)
  1081.             {
  1082.                 sprint (self, "Air supply in Biosuit expiring\n");
  1083.                 stuffcmd (self, "bf\n");
  1084.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1085.                 self.rad_time = time + 1;
  1086.             }
  1087.             
  1088.             if (self.rad_time < time)
  1089.             {
  1090.                 self.rad_time = time + 1;
  1091.                 stuffcmd (self, "bf\n");
  1092.             }
  1093.         }
  1094.  
  1095.         if (self.radsuit_finished < time)
  1096.         {    // just stopped
  1097.             self.items = self.items - IT_SUIT;
  1098.             self.rad_time = 0;
  1099.             self.radsuit_finished = 0;
  1100.         }
  1101.     }    
  1102.  
  1103. };
  1104.  
  1105.  
  1106. /*
  1107. ================
  1108. PlayerPostThink
  1109.  
  1110. Called every frame after physics are run
  1111. ================
  1112. */
  1113. void() PlayerPostThink =
  1114. {
  1115.     local    float    mspeed, aspeed;
  1116.     local    float    r;
  1117.  
  1118.     if (self.view_ofs == '0 0 0')
  1119.         return;        // intermission or finale
  1120.     if (self.deadflag)
  1121.         return;
  1122.         
  1123. // do weapon stuff
  1124.  
  1125.     W_WeaponFrame ();
  1126.  
  1127. // check to see if player landed and play landing sound    
  1128.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1129.     {
  1130.         if (self.watertype == CONTENT_WATER)
  1131.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1132.         else if (self.jump_flag < -650)
  1133.         {
  1134.             T_Damage (self, world, world, 5); 
  1135.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1136.             self.deathtype = "falling";
  1137.         }
  1138.         else
  1139.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1140.  
  1141.         self.jump_flag = 0;
  1142.     }
  1143.  
  1144.     if (!(self.flags & FL_ONGROUND))
  1145.         self.jump_flag = self.velocity_z;
  1146.  
  1147.     CheckPowerups ();
  1148. };
  1149.  
  1150.  
  1151. /*
  1152. ===========
  1153. ClientConnect
  1154.  
  1155. called when a player connects to a server
  1156. ============
  1157. */
  1158. void() ClientConnect =
  1159. {
  1160.     bprint (self.netname);
  1161.     bprint (" entered the game\n");
  1162.     
  1163. // a client connecting during an intermission can cause problems
  1164.     if (intermission_running)
  1165.         ExitIntermission ();
  1166. };
  1167.  
  1168.  
  1169. /*
  1170. ===========
  1171. ClientDisconnect
  1172.  
  1173. called when a player disconnects from a server
  1174. ============
  1175. */
  1176. void() ClientDisconnect =
  1177. {
  1178.     if (gameover)
  1179.         return;
  1180.     // if the level end trigger has been activated, just return
  1181.     // since they aren't *really* leaving
  1182.  
  1183.     // let everyone else know
  1184.     bprint (self.netname);
  1185.     bprint (" left the game with ");
  1186.     bprint (ftos(self.frags));
  1187.     bprint (" frags\n");
  1188.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1189.     set_suicide_frame ();
  1190. };
  1191.  
  1192. /*
  1193. ===========
  1194. ClientObituary
  1195.  
  1196. called when a player dies
  1197. ============
  1198. */
  1199. void(entity targ, entity attacker) ClientObituary =
  1200. {
  1201.     local    float rnum;
  1202.     local    string deathstring, deathstring2;
  1203.     rnum = random();
  1204.  
  1205.     if (targ.classname == "player")
  1206.     {
  1207.         if (attacker.classname == "teledeath")
  1208.         {
  1209.             bprint (targ.netname);
  1210.             bprint (" was telefragged by ");
  1211.             bprint (attacker.owner.netname);
  1212.             bprint ("\n");
  1213.  
  1214.             attacker.owner.frags = attacker.owner.frags + 1;
  1215.             return;
  1216.         }
  1217.  
  1218.         if (attacker.classname == "teledeath2")
  1219.         {
  1220.             bprint ("Satan's power deflects ");
  1221.             bprint (targ.netname);
  1222.             bprint ("'s telefrag\n");
  1223.  
  1224.             targ.frags = targ.frags - 1;
  1225.             return;
  1226.         }
  1227.  
  1228.         if (attacker.classname == "player")
  1229.         {
  1230.             if (targ == attacker)
  1231.             {
  1232.                 // killed self
  1233.                 attacker.frags = attacker.frags - 1;
  1234.                 bprint (targ.netname);
  1235.                 
  1236.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1237.                 {
  1238.                     bprint (" discharges into the water.\n");
  1239.                     return;
  1240.                 }
  1241.                 if (targ.weapon == IT_GRENADE_LAUNCHER)
  1242.                     bprint (" tries to put the pin back in\n");
  1243.                 else
  1244.                     bprint (" becomes bored with life\n");
  1245.                 return;
  1246.             }
  1247.             else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
  1248.             {
  1249.                 if (rnum < 0.25)
  1250.                     deathstring = " mows down a teammate\n";
  1251.                 else if (rnum < 0.50)
  1252.                     deathstring = " checks his glasses\n";
  1253.                 else if (rnum < 0.75)
  1254.                     deathstring = " gets a frag for the other team\n";
  1255.                 else
  1256.                     deathstring = " loses another friend\n";
  1257.                 bprint (attacker.netname);
  1258.                 bprint (deathstring);
  1259.                 attacker.frags = attacker.frags - 1;
  1260.                 return;
  1261.             }
  1262.             else
  1263.             {
  1264.                 attacker.frags = attacker.frags + 1;
  1265.  
  1266.                 rnum = attacker.weapon;
  1267.                 if (rnum == IT_AXE)
  1268.                 {
  1269.                     deathstring = " was ax-murdered by ";
  1270.                     deathstring2 = "\n";
  1271.                 }
  1272.                 if (rnum == IT_SHOTGUN)
  1273.                 {
  1274.                     deathstring = " chewed on ";
  1275.                     deathstring2 = "'s boomstick\n";
  1276.                 }
  1277.                 if (rnum == IT_SUPER_SHOTGUN)
  1278.                 {
  1279.                     deathstring = " ate 2 loads of ";
  1280.                     deathstring2 = "'s buckshot\n";
  1281.                 }
  1282.                 if (rnum == IT_NAILGUN)
  1283.                 {
  1284.                     deathstring = " was nailed by ";
  1285.                     deathstring2 = "\n";
  1286.                 }
  1287.                 if (rnum == IT_SUPER_NAILGUN)
  1288.                 {
  1289.                     deathstring = " was punctured by ";
  1290.                     deathstring2 = "\n";
  1291.                 }
  1292.                 if (rnum == IT_GRENADE_LAUNCHER)
  1293.                 {
  1294.                     deathstring = " eats ";
  1295.                     deathstring2 = "'s pineapple\n";
  1296.                     if (targ.health < -40)
  1297.                     {
  1298.                         deathstring = " was gibbed by ";
  1299.                         deathstring2 = "'s grenade\n";
  1300.                     }
  1301.                 }
  1302.                 if (rnum == IT_ROCKET_LAUNCHER)
  1303.                 {
  1304.                     deathstring = " rides ";
  1305.                     deathstring2 = "'s rocket\n";
  1306.                     if (targ.health < -40)
  1307.                     {
  1308.                         deathstring = " was gibbed by ";
  1309.                         deathstring2 = "'s rocket\n" ;
  1310.                     }
  1311.                 }
  1312.                 if (rnum == IT_LIGHTNING)
  1313.                 {
  1314.                     deathstring = " accepts ";
  1315.                     if (attacker.waterlevel > 1)
  1316.                         deathstring2 = "'s discharge\n";
  1317.                     else
  1318.                         deathstring2 = "'s shaft\n";
  1319.                 }
  1320.                 bprint (targ.netname);
  1321.                 bprint (deathstring);
  1322.                 bprint (attacker.netname);
  1323.                 bprint (deathstring2);
  1324.             }
  1325.             return;
  1326.         }
  1327.         else
  1328.         {
  1329.             targ.frags = targ.frags - 1;
  1330.             bprint (targ.netname);
  1331.  
  1332.             // killed by a montser?
  1333.             if (attacker.flags & FL_MONSTER)
  1334.             {
  1335.                 if (attacker.classname == "monster_army")
  1336.                     bprint (" was shot by a Grunt\n");
  1337.                 if (attacker.classname == "monster_demon1")
  1338.                     bprint (" was eviscerated by a Fiend\n");
  1339.                 if (attacker.classname == "monster_dog")
  1340.                     bprint (" was mauled by a Rottweiler\n");
  1341.                 if (attacker.classname == "monster_dragon")
  1342.                     bprint (" was fried by a Dragon\n");
  1343.                 if (attacker.classname == "monster_enforcer")
  1344.                     bprint (" was blasted by an Enforcer\n");
  1345.                 if (attacker.classname == "monster_fish")
  1346.                     bprint (" was fed to the Rotfish\n");
  1347.                 if (attacker.classname == "monster_hell_knight")
  1348.                     bprint (" was slain by a Death Knight\n");
  1349.                 if (attacker.classname == "monster_knight")
  1350.                     bprint (" was slashed by a Knight\n");
  1351.                 if (attacker.classname == "monster_ogre")
  1352.                     bprint (" was destroyed by an Ogre\n");
  1353.                 if (attacker.classname == "monster_oldone")
  1354.                     bprint (" became one with Shub-Niggurath\n");
  1355.                 if (attacker.classname == "monster_shalrath")
  1356.                     bprint (" was exploded by a Vore\n");
  1357.                 if (attacker.classname == "monster_shambler")
  1358.                     bprint (" was smashed by a Shambler\n");
  1359.                 if (attacker.classname == "monster_tarbaby")
  1360.                     bprint (" was slimed by a Spawn\n");
  1361.                 if (attacker.classname == "monster_vomit")
  1362.                     bprint (" was vomited on by a Vomitus\n");
  1363.                 if (attacker.classname == "monster_wizard")
  1364.                     bprint (" was scragged by a Scrag\n");
  1365.                 if (attacker.classname == "monster_zombie")
  1366.                     bprint (" joins the Zombies\n");
  1367.  
  1368.                 return;
  1369.             }
  1370.  
  1371.             // tricks and traps
  1372.             if (attacker.classname == "explo_box")
  1373.             {
  1374.                 bprint (" blew up\n");
  1375.                 return;
  1376.             }
  1377.             if (attacker.solid == SOLID_BSP && attacker != world)
  1378.             {    
  1379.                 bprint (" was squished\n");
  1380.                 return;
  1381.             }
  1382.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1383.             {
  1384.                 bprint (" was spiked\n");
  1385.                 return;
  1386.             }
  1387.             if (attacker.classname == "fireball")
  1388.             {
  1389.                 bprint (" ate a lavaball\n");
  1390.                 return;
  1391.             }
  1392.             if (attacker.classname == "trigger_changelevel")
  1393.             {
  1394.                 bprint (" tried to leave\n");
  1395.                 return;
  1396.             }
  1397.  
  1398.             // in-water deaths
  1399.             rnum = targ.watertype;
  1400.             if (rnum == -3)
  1401.             {
  1402.                 if (random() < 0.5)
  1403.                     bprint (" sleeps with the fishes\n");
  1404.                 else
  1405.                     bprint (" sucks it down\n");
  1406.                 return;
  1407.             }
  1408.             else if (rnum == -4)
  1409.             {
  1410.                 if (random() < 0.5)
  1411.                     bprint (" gulped a load of slime\n");
  1412.                 else
  1413.                     bprint (" can't exist on slime alone\n");
  1414.                 return;
  1415.             }
  1416.             else if (rnum == -5)
  1417.             {
  1418.                 if (targ.health < -15)
  1419.                 {
  1420.                     bprint (" burst into flames\n");
  1421.                     return;
  1422.                 }
  1423.                 if (random() < 0.5)
  1424.                     bprint (" turned into hot slag\n");
  1425.                 else
  1426.                     bprint (" visits the Volcano God\n");
  1427.                 return;
  1428.             }
  1429.  
  1430.             // fell to their death?
  1431.             if (targ.deathtype == "falling")
  1432.             {
  1433.                 targ.deathtype = "";
  1434.                 bprint (" fell to his death\n");
  1435.                 return;
  1436.             }
  1437.  
  1438.             // hell if I know; he's just dead!!!
  1439.             bprint (" died\n");
  1440.         }
  1441.     }
  1442. };
  1443.